SpatialInferCNV was produced as part of, and used in analysis for Erickson et al., 2021. Note: this will be updated with a doi link upon acceptance of the manuscript for publication.
This document, is intended to demonstrate:
library(SpatialInferCNV)
library(tidyverse)
The 10X Genomics SpaceRanger Pipeline outputs, among other files, filtered_feature_bc_matrix.h5 files that store count data. Count data, such as from the Visium assay, is a key input to Spatial InferCNV. 10X Genomics offers a number of publicly available 10x Genomics Visium datasets.
We will start by downloading a publicly available 10x Genomics Visium dataset Breast Cancer.
Then, we will read in the filtered_feature_bc_matrix.h5 file and convert it to the R data.frame format. Additionally, we will append a “Section Label”. This is because each 10x Genomics Visium assay uses the same set of barcodes, and thus we need to append an identifier to distinguish from which array comes which data.
# Downloading Breast Cancer Data H5 file
download.file("https://cf.10xgenomics.com/samples/spatial-exp/1.1.0/V1_Breast_Cancer_Block_A_Section_1/V1_Breast_Cancer_Block_A_Section_1_filtered_feature_bc_matrix.h5", "./V1_Breast_Cancer_Block_A_Section_1_filtered_feature_bc_matrix.h5", mode = "wb")
# Reading the 10X Visium Breast Cancer count data, and appending the string "Breast10X" before each barcode with ImportCountData()
Breast_ENSBMLID_Counts <- ImportCountData("Breast10X", "./V1_Breast_Cancer_Block_A_Section_1_filtered_feature_bc_matrix.h5")
# Delete the downloaded file from the directory
unlink("./V1_Breast_Cancer_Block_A_Section_1_filtered_feature_bc_matrix.h5")
# Showing the first part of the Breast_ENSBMLID_Counts dataframe
head(Breast_ENSBMLID_Counts)
We will first demonstrate how to create an annotation .csv file from the Loupe Browser, and then We will read in a .csv file containing histological annotations and convert it to the R data.frame format. Histological annotations in our manuscript were performed by clinicians, specifically, pathologists who are experts trained to visually assess histology of patient samples. Using manual annotations from clinicians allows for clinical translation in a spatial/biological context. These annotations are primarily used in our analyses as grouping variables to select/deselect spots with specific morphology for analysis. Specific details of how we designed the histological annotation process can be found in our manuscript (Update with publication link upon publication).
It is important to emphasize, that for our manuscript, histological annotation work was not done in R, but done using the 10X Genomics LoupeBrowser. For our manuscript, we used versions [INSERT VERSION NUMBERS].
For the sample in the above code chunk, 10X Genomics provides a Breast Cancer .cloupe Loupe Browser file file.
After opening the LoupeBrowser file, click the 3 white dots at upper right, and select “New Category”.
Type in “Histology” and click the green checkbox
Select the Polygonal Selection Tool at the center top.
Next, left click and drag around the 12 spots at the lower right of the section.
Next, left click and drag around the 12 spots at the lower right of the section.
Select “Histology” from the dropdown menu, and type in an annotation, in this example “Userguide_12”, and then click “Create new cluster”Userguide_12", and then click the save button to save the annotation.
If this all was done properly, you should see the following: